import { Controller } from "../../mvc/core/Controller";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { EventName } from "../mvc/EventName";
import { IView } from "../../mvc/interfaces/IView";
import { MobileBindModule } from "../../../modules/MobileBindModule";
import { DataEvent } from "../events/DataEvent";
//class MobileBindController
    
    export  class MobileBindController extends Controller
    {
       

        protected /* override */ initServer(): void
        {
            super.initServer();
            Dispatcher.addEventListener(EventName.MobileBindOpen, this.onMobileBindOpenHandler);
            Dispatcher.addEventListener(EventName.MobileBindClose, this.onMobileBindCloseHandler);
            return;
        }

        protected /* override */ initView(): IView
        {
            if (!this._mobileBindModule) 
            {
                this._mobileBindModule = new MobileBindModule();
            }
            _view = this._mobileBindModule;
            return this._mobileBindModule;
        }

        /* internal  */onMobileBindOpenHandler(arg1: DataEvent): void
        {
            view.show();
            return;
        }

        /* internal  */onMobileBindCloseHandler(arg1: DataEvent): void
        {
            if (isViewShow) 
            {
                this._mobileBindModule.hide();
            }
            return;
        }

        private /* var */_mobileBindModule: MobileBindModule;
    }
